package com.rlyy.facade;

import com.rlyy.common.param.Request;
import com.rlyy.common.response.Result;
import com.rlyy.common.response.ResultUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 用户列表
 *
 * @author yuanqinglong
 * @since 2021/9/18 14:09
 */
@Controller
public class UserListFacade {


    /**
     * 用户列表
     *
     * @param grpcRequest grpc请求
     * @return {@link Result}
     */
    @RequestMapping("rbac_user_list")
    public Result userList(Request grpcRequest) {
        String userName = grpcRequest.getData().getString("user_name");
        HashMap<Object, Object> map = new HashMap<>(4);
        map.put("user_id","1");
        map.put("user_name","zs");
        HashMap<Object, Object> map2 = new HashMap<>(4);
        map2.put("user_id","2");
        map2.put("user_name","ls");
        ArrayList<Object> list = new ArrayList<>(4);
        list.add(map);
        list.add(map2);
        HashMap<Object, Object> result = new HashMap<>(4);
        result.put("list",list);
        return ResultUtil.success(result);
    }
   static List<Object> list = new ArrayList(90000);

    public static void main(String[] args) {
        long l = System.currentTimeMillis();
        while (true){
            list.add(new Object());
            System.out.println(list.toString().length() +" : "+ list.size() + " : " + (System.currentTimeMillis() - l));
        }
    }
}
